Aksh1t commited on
Commit
bbd29a6
1 Parent(s): 0b24358

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
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
- async with client.chat(model_id=model_id) as chat:
14
- response = await chat(prompt)
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()