Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import random
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
-
import google.generativeai as genai
|
5 |
|
6 |
# Initialize the Gemini model
|
7 |
-
Model = genai.GenerativeModel('gemini-1.5-flash')
|
8 |
|
9 |
def chat_short_story(length, genre, theme, tone, writing_style):
|
10 |
"""
|
@@ -39,9 +39,9 @@ def chat_short_story(length, genre, theme, tone, writing_style):
|
|
39 |
|
40 |
# Generate a response using the Gemini model
|
41 |
try:
|
42 |
-
chat = Model.start_chat()
|
43 |
-
response = chat.send_message(prompt)
|
44 |
-
return response.text
|
45 |
except Exception as e:
|
46 |
return f"Error: Failed to generate story. Details: {e}"
|
47 |
|
@@ -80,7 +80,7 @@ iface = gr.Interface(
|
|
80 |
gr.Dropdown(label="Story Tone", choices=Tones)
|
81 |
],
|
82 |
outputs=gr.Textbox(label="Generated Story"),
|
83 |
-
title="Patrick's Story Generator",
|
84 |
description="Generate creative short stories tailored to your preferences."
|
85 |
)
|
86 |
|
|
|
1 |
import random
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
+
import google.generativeai as genai
|
5 |
|
6 |
# Initialize the Gemini model
|
7 |
+
Model = genai.GenerativeModel('gemini-1.5-flash')
|
8 |
|
9 |
def chat_short_story(length, genre, theme, tone, writing_style):
|
10 |
"""
|
|
|
39 |
|
40 |
# Generate a response using the Gemini model
|
41 |
try:
|
42 |
+
chat = Model.start_chat()
|
43 |
+
response = chat.send_message(prompt)
|
44 |
+
return response.text
|
45 |
except Exception as e:
|
46 |
return f"Error: Failed to generate story. Details: {e}"
|
47 |
|
|
|
80 |
gr.Dropdown(label="Story Tone", choices=Tones)
|
81 |
],
|
82 |
outputs=gr.Textbox(label="Generated Story"),
|
83 |
+
title="Welcome to Patrick's Story Generator",
|
84 |
description="Generate creative short stories tailored to your preferences."
|
85 |
)
|
86 |
|