Blessin commited on
Commit
8d77ca3
·
1 Parent(s): 56c012f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
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=["text", "text", "text", "text", "text", "text"],
 
 
 
 
 
 
 
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."