CognitiveScience commited on
Commit
26eafd8
·
1 Parent(s): 2546eea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -32
app.py CHANGED
@@ -114,25 +114,33 @@ def respond3(message, chat_history):
114
  with gr.Blocks() as demo:
115
  with gr.Row():
116
  with gr.Column():
117
- with gr.Box():
118
- gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
119
- #data = gr.Dataframe()
120
- count = gr.Number(label="Total number of reviews")
121
- name = gr.Textbox(label="Name", placeholder="ur name?")
122
- review = gr.Radio(label="How satisfied are you with your pick?", choices=[1, 2, 3, 4, 5, 6])
123
- comments = gr.Textbox(label="Comments0", lines=10, placeholder="comm?")
124
- cssubmit = gr.Button(value="Submit Choice")
125
- #cschatbot = gr.Chatbot()
126
- #csinp = gr.Textbox()
127
- #csout=cs(csinp)
128
- #csclear = gr.ClearButton([csinp, cschatbot])
129
-
130
- #csinp.submit(cs, [csinp, cschatbot], [csinp, cschatbot])
131
-
132
- def cs(link):
133
- response="Hi " + link #(link) #acf("hello world")[0]["label"] + str(math.trunc(acf("hello world")[0]["score"])*100/100)+bcf(link)
134
- return response,1 #result #soup.prettify()
135
- cssubmit.click(cs, name, [comments,count])
 
 
 
 
 
 
 
 
136
 
137
  with gr.Row():
138
  with gr.Column():
@@ -170,21 +178,21 @@ with gr.Blocks() as demo:
170
  repo.push_to_hub(blocking=False, commit_message=f"Updating data at {datetime.datetime.now()}")
171
  submit.click(backup_db2)
172
  with gr.Column():
173
- with gr.Box():
174
- gr.Code(
175
- value="""def hello_world():
176
- return "Hello, world!"
177
 
178
- print(hello_world())""",
179
- language="python",
180
- interactive=True,
181
- show_label=False,
182
- )
183
- gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
184
- data = gr.Dataframe()
185
- count = gr.Number(label="Total number of reviews")
186
 
187
- submit.click(add_review, [name, review, comments], [data, count])
188
 
189
  #cssubmit.click(add_review, [name, review, comments], [data, count])
190
 
 
114
  with gr.Blocks() as demo:
115
  with gr.Row():
116
  with gr.Column():
117
+ gr.Markdown("This is a demo of using gr.Interface inside blocks.")
118
+ with gr.Row():
119
+ data = gr.Dataframe()
120
+ count = gr.Number(label="Total number of reviews")
121
+
122
+ submit.click(add_review, [name, review, comments], [data, count])
123
+ #data = gr.Dataframe()
124
+ count = gr.Number(label="Total number of reviews")
125
+ name = gr.Textbox(label="Name", placeholder="ur name?")
126
+ review = gr.Radio(label="How satisfied are you with your pick?", choices=[1, 2, 3, 4, 5, 6])
127
+ comments = gr.Textbox(label="Comments0", lines=10, placeholder="comm?")
128
+ cssubmit = gr.Button(value="Submit Choice")
129
+ #cschatbot = gr.Chatbot()
130
+ #csinp = gr.Textbox()
131
+ #csout=cs(csinp)
132
+ #csclear = gr.ClearButton([csinp, cschatbot])
133
+
134
+ #csinp.submit(cs, [csinp, cschatbot], [csinp, cschatbot])
135
+
136
+ def cs(link):
137
+ response="Hi " + link #(link) #acf("hello world")[0]["label"] + str(math.trunc(acf("hello world")[0]["score"])*100/100)+bcf(link)
138
+ return response,1 #result #soup.prettify()
139
+ cssubmit.click(cs, name, [comments,count])
140
+ interface = gr.Interface(reverse, gr.Textbox(), gr.Textbox())
141
+ interface.launch(inline=True)
142
+ #gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
143
+
144
 
145
  with gr.Row():
146
  with gr.Column():
 
178
  repo.push_to_hub(blocking=False, commit_message=f"Updating data at {datetime.datetime.now()}")
179
  submit.click(backup_db2)
180
  with gr.Column():
181
+ #with gr.Box():
182
+ # gr.Code(
183
+ # value="""def hello_world():
184
+ #return "Hello, world!"
185
 
186
+ #print(hello_world())""",
187
+ # language="python",
188
+ # interactive=True,
189
+ # show_label=False,
190
+ # )
191
+ #gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
192
+ #data = gr.Dataframe()
193
+ #count = gr.Number(label="Total number of reviews")
194
 
195
+ #submit.click(add_review, [name, review, comments], [data, count])
196
 
197
  #cssubmit.click(add_review, [name, review, comments], [data, count])
198