Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -84,6 +84,7 @@ def run_simulation(topic,
|
|
| 84 |
news_company="CNN",
|
| 85 |
text_model_name=""):
|
| 86 |
console_logs = StringIO()
|
|
|
|
| 87 |
filename = topic.replace(" ", "-") + ".csv"
|
| 88 |
tweet_folder="data/fake-tweets"
|
| 89 |
tweet_failfolder="data/failed-tweets"
|
|
@@ -120,10 +121,11 @@ def run_simulation(topic,
|
|
| 120 |
subfolder = topic.replace(" ", "-")
|
| 121 |
img_filename = f"{image_folder}/{subfolder}/tweet-img-row-0.png"
|
| 122 |
img_fullpath = os.path.join(os.path.dirname(__file__), img_filename)
|
| 123 |
-
|
| 124 |
return {
|
| 125 |
-
progress_box: "Simulation finished. To see your results, visit the bot simulation Mastodon server
|
| 126 |
log_output: console_logs.getvalue(),
|
|
|
|
| 127 |
simulation_output_box: gr.update(visible=True),
|
| 128 |
saved_file: tweet_filename,
|
| 129 |
example_image: img_fullpath
|
|
@@ -273,6 +275,7 @@ with gr.Blocks() as demo:
|
|
| 273 |
with gr.Row(elem_id="progress_box") as progress_box:
|
| 274 |
progress_box = gr.Textbox(label="Current Progress", show_label=True)
|
| 275 |
log_output = gr.Textbox(every=0.5, label="Logs", lines=8)
|
|
|
|
| 276 |
|
| 277 |
with gr.Row(elem_id="simulation_output_box", visible=False) as simulation_output_box:
|
| 278 |
saved_file = gr.File(label="List of Generated Tweets (CSV)")
|
|
@@ -296,6 +299,7 @@ with gr.Blocks() as demo:
|
|
| 296 |
],
|
| 297 |
outputs=[progress_box,
|
| 298 |
log_output,
|
|
|
|
| 299 |
simulation_output_box,
|
| 300 |
saved_file,
|
| 301 |
example_image
|
|
|
|
| 84 |
news_company="CNN",
|
| 85 |
text_model_name=""):
|
| 86 |
console_logs = StringIO()
|
| 87 |
+
sys.stdout = console_logs
|
| 88 |
filename = topic.replace(" ", "-") + ".csv"
|
| 89 |
tweet_folder="data/fake-tweets"
|
| 90 |
tweet_failfolder="data/failed-tweets"
|
|
|
|
| 121 |
subfolder = topic.replace(" ", "-")
|
| 122 |
img_filename = f"{image_folder}/{subfolder}/tweet-img-row-0.png"
|
| 123 |
img_fullpath = os.path.join(os.path.dirname(__file__), img_filename)
|
| 124 |
+
sys.stdout=restore_point
|
| 125 |
return {
|
| 126 |
+
progress_box: "Simulation finished. To see your results, visit the bot simulation Mastodon server.",
|
| 127 |
log_output: console_logs.getvalue(),
|
| 128 |
+
mastodon_link: gr.update(visible=True),
|
| 129 |
simulation_output_box: gr.update(visible=True),
|
| 130 |
saved_file: tweet_filename,
|
| 131 |
example_image: img_fullpath
|
|
|
|
| 275 |
with gr.Row(elem_id="progress_box") as progress_box:
|
| 276 |
progress_box = gr.Textbox(label="Current Progress", show_label=True)
|
| 277 |
log_output = gr.Textbox(every=0.5, label="Logs", lines=8)
|
| 278 |
+
mastodon_link = gr.Markdown("Link to Mastodon Server: [https://bot-simulation-research.app/home](https://bot-simulation-research.app/home)", visible=False)
|
| 279 |
|
| 280 |
with gr.Row(elem_id="simulation_output_box", visible=False) as simulation_output_box:
|
| 281 |
saved_file = gr.File(label="List of Generated Tweets (CSV)")
|
|
|
|
| 299 |
],
|
| 300 |
outputs=[progress_box,
|
| 301 |
log_output,
|
| 302 |
+
mastodon_link,
|
| 303 |
simulation_output_box,
|
| 304 |
saved_file,
|
| 305 |
example_image
|