Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import random
|
|
| 3 |
import openai
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
-
def generate_improv_scene(api_key):
|
| 7 |
# Initialize the OpenAI API client with the provided key
|
| 8 |
openai.api_key = api_key
|
| 9 |
|
|
@@ -28,8 +28,15 @@ def generate_improv_scene(api_key):
|
|
| 28 |
# Create Gradio UI
|
| 29 |
iface = gr.Interface(
|
| 30 |
fn=generate_improv_scene,
|
| 31 |
-
inputs=["text"], # Input for OpenAI API Key
|
| 32 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
live=True,
|
| 34 |
title="Improv Scene Generator",
|
| 35 |
description="Generate a random improv scene with dialogue, emotion, situation, location, relationship, and occupation."
|
|
|
|
| 3 |
import openai
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
+
def generate_improv_scene(api_key, regenerate_button):
|
| 7 |
# Initialize the OpenAI API client with the provided key
|
| 8 |
openai.api_key = api_key
|
| 9 |
|
|
|
|
| 28 |
# Create Gradio UI
|
| 29 |
iface = gr.Interface(
|
| 30 |
fn=generate_improv_scene,
|
| 31 |
+
inputs=["text", gr.inputs.Button(label="Regenerate")], # Input for OpenAI API Key and a button to regenerate
|
| 32 |
+
outputs=[
|
| 33 |
+
gr.outputs.Textbox(label="Dialogue"),
|
| 34 |
+
gr.outputs.Textbox(label="Emotion"),
|
| 35 |
+
gr.outputs.Textbox(label="Situation"),
|
| 36 |
+
gr.outputs.Textbox(label="Location"),
|
| 37 |
+
gr.outputs.Textbox(label="Relationship"),
|
| 38 |
+
gr.outputs.Textbox(label="Occupation")
|
| 39 |
+
],
|
| 40 |
live=True,
|
| 41 |
title="Improv Scene Generator",
|
| 42 |
description="Generate a random improv scene with dialogue, emotion, situation, location, relationship, and occupation."
|