Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,9 +10,8 @@ client = InferenceClient()
|
|
10 |
|
11 |
async def generate_text(prompt):
|
12 |
# Use the Hugging Face client to generate text asynchronously
|
13 |
-
|
14 |
-
|
15 |
-
return response['generated_text']
|
16 |
|
17 |
# Create Gradio interface
|
18 |
inputs = gr.Textbox(label="Enter a prompt", lines=2)
|
@@ -26,4 +25,3 @@ iface = gr.Interface(fn=predict, inputs=inputs, outputs=outputs, title="Hugging
|
|
26 |
|
27 |
if __name__ == "__main__":
|
28 |
iface.launch()
|
29 |
-
|
|
|
10 |
|
11 |
async def generate_text(prompt):
|
12 |
# Use the Hugging Face client to generate text asynchronously
|
13 |
+
response = await client.text_generation(model=model_id, inputs=prompt)
|
14 |
+
return response['generated_text']
|
|
|
15 |
|
16 |
# Create Gradio interface
|
17 |
inputs = gr.Textbox(label="Enter a prompt", lines=2)
|
|
|
25 |
|
26 |
if __name__ == "__main__":
|
27 |
iface.launch()
|
|