NadaAljohani commited on
Commit
41b4109
1 Parent(s): 7b11466

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -48,3 +48,29 @@ def generate_story(title, model_name="gpt2"):
48
 
49
  # Return the cleaned and formatted story
50
  return cleaned_story
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  # Return the cleaned and formatted story
50
  return cleaned_story
51
+
52
+ # Create the Gradio interface using gr.Interface
53
+ demo = gr.Interface(
54
+ fn=generate_story,
55
+ inputs=[
56
+ gr.Textbox(label="Enter Story Title", placeholder="Type a title here..."), # Title input
57
+ gr.Dropdown(choices=[
58
+ 'gpt2',
59
+ 'gpt2-large',
60
+ 'EleutherAI/gpt-neo-2.7B',
61
+ 'EleutherAI/gpt-j-6B',
62
+ 'maldv/badger-writer-llama-3-8b',
63
+ 'gpt-neo-2.7B'
64
+ ], value='gpt2', label="Choose Model") # Model selection
65
+ ],
66
+ outputs="text",
67
+ title="AI Story Generator",
68
+ description="Generate a creative story using different AI models.",
69
+ examples=[
70
+ ["Sara burst into her friend's house, only to find it plunged into darkness. A strange, pulsing glow flickered from the corner, casting eerie shadows on the walls. Her heart raced as she called out, but there was no answer. Something wasn’t right. On the table sat an unfamiliar, glowing device—humming with energy. With a deep breath, Sara stepped closer, knowing that once she touched it, there would be no turning back."]
71
+ ]
72
+ )
73
+
74
+ # Launch the interface with sharing enabled
75
+ demo.launch(share=True)
76
+