Z3ktrix commited on
Commit
79a23f3
Β·
verified Β·
1 Parent(s): 094ee51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
  #import gradio as gr
4
  #gr.load("models/mistralai/Mistral-7B-Instruct-v0.3").launch()
5
 
@@ -20,9 +18,12 @@ def query(payload):
20
 
21
  def chatbot_response(input_text):
22
  response = query({"inputs": input_text})
23
- if 'error' in response:
24
- return response['error']
25
- return response.get('generated_text', 'No response generated.')
 
 
 
26
 
27
  # Gradio interface
28
  def main():
 
 
 
1
  #import gradio as gr
2
  #gr.load("models/mistralai/Mistral-7B-Instruct-v0.3").launch()
3
 
 
18
 
19
  def chatbot_response(input_text):
20
  response = query({"inputs": input_text})
21
+ # Extract the generated text from the response
22
+ if isinstance(response, dict) and 'generated_text' in response:
23
+ return response['generated_text']
24
+ elif isinstance(response, list) and len(response) > 0 and 'generated_text' in response[0]:
25
+ return response[0]['generated_text']
26
+ return 'No response generated.'
27
 
28
  # Gradio interface
29
  def main():