mgokg commited on
Commit
71b2ceb
·
verified ·
1 Parent(s): dfec7ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  from openai import OpenAI
3
  import os
 
4
 
5
  # Liste der verfügbaren Modelle
6
  MODELS = [
@@ -40,7 +41,13 @@ def predict(model, input_text):
40
  stop=None,
41
  )
42
 
43
- return completion.choices[0].message.content
 
 
 
 
 
 
44
 
45
  # Erstelle die Gradio Oberfläche
46
  with gr.Blocks() as demo:
@@ -60,13 +67,13 @@ with gr.Blocks() as demo:
60
  )
61
 
62
  output_text = gr.Textbox(label="Antwort", interactive=False)
63
-
64
- submit_btn = gr.Button("Absenden")
65
- submit_btn.click(
66
  fn=predict,
67
  inputs=[model_dropdown, input_text],
68
  outputs=output_text
69
  )
 
 
70
 
71
  if __name__ == "__main__":
72
  demo.launch()
 
1
  import gradio as gr
2
  from openai import OpenAI
3
  import os
4
+ from IPython.display import display, Markdown
5
 
6
  # Liste der verfügbaren Modelle
7
  MODELS = [
 
41
  stop=None,
42
  )
43
 
44
+ # Hole die Antwort des Modells
45
+ response = completion.choices[0].message.content
46
+
47
+ # Zeige die Antwort als Markdown an
48
+ display(Markdown(f"**Antwort des Modells ({model}):**\n\n{response}"))
49
+
50
+ return response
51
 
52
  # Erstelle die Gradio Oberfläche
53
  with gr.Blocks() as demo:
 
67
  )
68
 
69
  output_text = gr.Textbox(label="Antwort", interactive=False)
70
+ input_text.submit(
 
 
71
  fn=predict,
72
  inputs=[model_dropdown, input_text],
73
  outputs=output_text
74
  )
75
+ #submit_btn = gr.Button("Absenden")
76
+ #submit_btn.click
77
 
78
  if __name__ == "__main__":
79
  demo.launch()