Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
import sys
|
| 3 |
import subprocess
|
| 4 |
import os
|
|
@@ -82,7 +82,7 @@ def run_simulation(topic,
|
|
| 82 |
image_subtoken="Provide a realistic photograph. ",
|
| 83 |
image_tokens=[],
|
| 84 |
news_company="CNN",
|
| 85 |
-
text_model_name=""):
|
| 86 |
console_logs = StringIO()
|
| 87 |
sys.stdout = console_logs
|
| 88 |
filename = topic.replace(" ", "-") + ".csv"
|
|
@@ -259,16 +259,15 @@ with gr.Blocks() as demo:
|
|
| 259 |
news_company = gr.Dropdown(label="News Company Logo to use",
|
| 260 |
value="CNN",
|
| 261 |
choices=[
|
| 262 |
-
"CNN"
|
| 263 |
-
])
|
| 264 |
text_model_name = gr.Dropdown(value="gpt-3.5-turbo-0301",
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
with_images.change(toggle_image_params, with_images, [image_params])
|
| 273 |
|
| 274 |
with gr.Row(elem_id="progress_box") as progress_box:
|
|
@@ -295,14 +294,12 @@ with gr.Blocks() as demo:
|
|
| 295 |
image_every_n_posts,
|
| 296 |
image_subtoken,
|
| 297 |
news_company,
|
| 298 |
-
text_model_name
|
| 299 |
-
],
|
| 300 |
outputs=[progress_box,
|
| 301 |
log_output,
|
| 302 |
simulation_output_box,
|
| 303 |
saved_file,
|
| 304 |
-
example_image
|
| 305 |
-
])
|
| 306 |
|
| 307 |
with gr.Row(elem_id="init_btn", visible=True) as init_btn:
|
| 308 |
submit_btn = gr.Button("Initialize Bot")
|
|
@@ -319,8 +316,11 @@ with gr.Blocks() as demo:
|
|
| 319 |
main_block_step_1,
|
| 320 |
main_block_step_2,
|
| 321 |
init_btn,
|
| 322 |
-
run_sim_btn
|
| 323 |
-
|
|
|
|
|
|
|
|
|
|
| 324 |
|
| 325 |
with gr.Column(elem_id = "user_consent_container") as user_consent_block:
|
| 326 |
accept_checkbox = gr.Checkbox(visible=False)
|
|
|
|
| 1 |
+
mport gradio as gr
|
| 2 |
import sys
|
| 3 |
import subprocess
|
| 4 |
import os
|
|
|
|
| 82 |
image_subtoken="Provide a realistic photograph. ",
|
| 83 |
image_tokens=[],
|
| 84 |
news_company="CNN",
|
| 85 |
+
text_model_name="gpt-3.5-turbo-0301"):
|
| 86 |
console_logs = StringIO()
|
| 87 |
sys.stdout = console_logs
|
| 88 |
filename = topic.replace(" ", "-") + ".csv"
|
|
|
|
| 259 |
news_company = gr.Dropdown(label="News Company Logo to use",
|
| 260 |
value="CNN",
|
| 261 |
choices=[
|
| 262 |
+
"CNN"])
|
|
|
|
| 263 |
text_model_name = gr.Dropdown(value="gpt-3.5-turbo-0301",
|
| 264 |
+
label="Select Text Model to use",
|
| 265 |
+
choices=["gpt-3.5-turbo",
|
| 266 |
+
"gpt-3.5-turbo-0301",
|
| 267 |
+
"gpt-4",
|
| 268 |
+
"gpt-4-0314",
|
| 269 |
+
"gpt-4-32k",
|
| 270 |
+
"gpt-4-32k-0314"])
|
| 271 |
with_images.change(toggle_image_params, with_images, [image_params])
|
| 272 |
|
| 273 |
with gr.Row(elem_id="progress_box") as progress_box:
|
|
|
|
| 294 |
image_every_n_posts,
|
| 295 |
image_subtoken,
|
| 296 |
news_company,
|
| 297 |
+
text_model_name],
|
|
|
|
| 298 |
outputs=[progress_box,
|
| 299 |
log_output,
|
| 300 |
simulation_output_box,
|
| 301 |
saved_file,
|
| 302 |
+
example_image])
|
|
|
|
| 303 |
|
| 304 |
with gr.Row(elem_id="init_btn", visible=True) as init_btn:
|
| 305 |
submit_btn = gr.Button("Initialize Bot")
|
|
|
|
| 316 |
main_block_step_1,
|
| 317 |
main_block_step_2,
|
| 318 |
init_btn,
|
| 319 |
+
run_sim_btn])
|
| 320 |
+
|
| 321 |
+
with gr.Row(elem_id="reset_block", visible=True) as reset_block:
|
| 322 |
+
reset_btn = gr.Button("Reset")
|
| 323 |
+
# reset_btn.click()
|
| 324 |
|
| 325 |
with gr.Column(elem_id = "user_consent_container") as user_consent_block:
|
| 326 |
accept_checkbox = gr.Checkbox(visible=False)
|