awacke1 commited on
Commit
362108d
1 Parent(s): 73d2aa3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -4
app.py CHANGED
@@ -10,6 +10,25 @@ URLS = [
10
  "https://api-inference.huggingface.co/models/google/flan-ul2",
11
  "https://api-inference.huggingface.co/models/google/flan-t5-xxl",
12
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  def fetch(session, text, api_url):
15
  model = api_url.split("/")[-1]
@@ -73,13 +92,24 @@ def app():
73
  def handle_display_history():
74
  display_history()
75
 
76
- gr.Interface(fn=predict_text, inputs=inputs, outputs=outputs, title=title, description=description).launch()
 
 
77
 
78
- feedback_ui = gr.Interface(fn=handle_feedback, inputs=[inputs, feedback_box, feedback_text, feedback_button], outputs=gr.outputs.Textbox(label="Feedback Submitted"), title="Feedback", description="Please provide feedback on the model's response.")
79
 
80
- display_history_ui = gr.Interface(fn=handle_display_history, inputs=display_history_button, outputs=gr.outputs.Textbox(label="Feedback History"), title="Feedback History", description="View history of feedback submissions.")
81
 
82
- gr.Interface([feedback_ui, display_history_ui], columns=2, title="Flan Feedback").launch()
 
 
 
 
 
 
 
 
 
83
 
84
  if name == 'main':
85
  app()
 
10
  "https://api-inference.huggingface.co/models/google/flan-ul2",
11
  "https://api-inference.huggingface.co/models/google/flan-t5-xxl",
12
  ]
13
+ examples = [
14
+ ["Please answer to the following question. Who is going to be the next Ballon d'or?"],
15
+ ["Q: Can Barack Obama have a conversation with George Washington? Give the rationale before answering."],
16
+ ["Summarize the following text: Peter and Elizabeth took a taxi to attend the night party in the city. While in the party, Elizabeth collapsed and was rushed to the hospital. Since she was diagnosed with a brain injury, the doctor told Peter to stay besides her until she gets well. Therefore, Peter stayed with her at the hospital for 3 days without leaving."],
17
+ ["Please answer the following question: What is the boiling point of water?"],
18
+ ["Answer the following question by detailing your reasoning: Are Pokemons alive?"],
19
+ ["Translate to German: How old are you?"],
20
+ ["Generate a cooking recipe to make bolognese pasta:"],
21
+ ["Answer the following yes/no question by reasoning step-by-step. Can you write a whole Haiku in a single tweet?"],
22
+ ["Premise: At my age you will probably have learnt one lesson. Hypothesis: It's not certain how many lessons you'll learn by your thirties. Does the premise entail the hypothesis?"],
23
+ ["Answer the following question by reasoning step by step. The cafeteria had 23 apples. If they used 20 for lunch and bought 6 more, how many apples do they have?"],
24
+ ["""Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?
25
+ A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.
26
+ Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?"""],
27
+ ]
28
+ title = "Flan UL2 vs Flan T5 XXL"
29
+ description = "This demo compares [Flan-T5-xxl](https://huggingface.co/google/flan-t5-xxl) and [Flan-UL2](https://huggingface.co/google/flan-ul2). Learn more about these models in their model card!"
30
+
31
+
32
 
33
  def fetch(session, text, api_url):
34
  model = api_url.split("/")[-1]
 
92
  def handle_display_history():
93
  display_history()
94
 
95
+ #gr.Interface(fn=predict_text, inputs=inputs, outputs=outputs, title=title, description=description).launch()
96
+
97
+ #feedback_ui = gr.Interface(fn=handle_feedback, inputs=[inputs, feedback_box, feedback_text, feedback_button], outputs=gr.outputs.Textbox(label="Feedback Submitted"), title="Feedback", description="Please provide feedback on the model's response.")
98
 
99
+ #display_history_ui = gr.Interface(fn=handle_display_history, inputs=display_history_button, outputs=gr.outputs.Textbox(label="Feedback History"), title="Feedback History", description="View history of feedback submissions.")
100
 
101
+ #gr.Interface([feedback_ui, display_history_ui], columns=2, title="Flan Feedback").launch()
102
 
103
+
104
+ io = gr.Interface(
105
+ inference,
106
+ gr.Textbox(lines=3),
107
+ outputs=[gr.Textbox(lines=3, label="Flan T5-UL2"), gr.Textbox(lines=3, label="Flan T5-XXL")],
108
+ title=title,
109
+ description=description,
110
+ examples=examples,
111
+ )
112
+ io.launch()
113
 
114
  if name == 'main':
115
  app()