akhaliq HF Staff commited on
Commit
008f64a
·
1 Parent(s): a239a2c

Fix API return type annotation to map outputs properly as Textbox

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import time
3
  import torch
 
4
  from fastapi.responses import HTMLResponse
5
  from gradio import Server
6
 
@@ -321,7 +322,7 @@ if has_spaces:
321
  temperature: float = 1.0,
322
  top_p: float = 0.95,
323
  max_tokens: int = 4096
324
- ):
325
  if is_fallback:
326
  yield from simulate_inference(message)
327
  else:
@@ -334,7 +335,7 @@ else:
334
  temperature: float = 1.0,
335
  top_p: float = 0.95,
336
  max_tokens: int = 4096
337
- ):
338
  if is_fallback:
339
  yield from simulate_inference(message)
340
  else:
 
1
  import os
2
  import time
3
  import torch
4
+ from typing import Generator
5
  from fastapi.responses import HTMLResponse
6
  from gradio import Server
7
 
 
322
  temperature: float = 1.0,
323
  top_p: float = 0.95,
324
  max_tokens: int = 4096
325
+ ) -> Generator[str, None, None]:
326
  if is_fallback:
327
  yield from simulate_inference(message)
328
  else:
 
335
  temperature: float = 1.0,
336
  top_p: float = 0.95,
337
  max_tokens: int = 4096
338
+ ) -> Generator[str, None, None]:
339
  if is_fallback:
340
  yield from simulate_inference(message)
341
  else: