Update app.py
Browse files
app.py
CHANGED
@@ -9,26 +9,21 @@ client = Client()
|
|
9 |
def generate_writing_prompt(user_input):
|
10 |
response = client.chat.completions.create(
|
11 |
model="gpt-3.5-turbo",
|
12 |
-
messages=[
|
|
|
|
|
|
|
13 |
)
|
14 |
return response.choices[0].message.content
|
15 |
|
16 |
-
# Gradio
|
17 |
-
|
18 |
fn=generate_writing_prompt,
|
19 |
-
|
20 |
-
|
21 |
-
title="Creative Writing Assistant 📝",
|
22 |
-
description="Unleash your creativity! Get inspired with unique story ideas, prompts, and plot twists.",
|
23 |
theme="huggingface",
|
24 |
-
examples=[
|
25 |
-
["A story about a lost civilization discovering technology."],
|
26 |
-
["Compose a poem about the changing seasons."],
|
27 |
-
["A suspense thriller set in an abandoned mansion."],
|
28 |
-
]
|
29 |
)
|
30 |
|
31 |
-
|
32 |
# Launch the interface
|
33 |
if __name__ == "__main__":
|
34 |
-
|
|
|
9 |
def generate_writing_prompt(user_input):
|
10 |
response = client.chat.completions.create(
|
11 |
model="gpt-3.5-turbo",
|
12 |
+
messages=[
|
13 |
+
{"role": "system", "content": "Du bist Alex, ein kreativer Assistent. Antworte immer auf Deutsch und hilf bei der Erstellung von kreativen Schreibideen und Eingabeaufforderungen."},
|
14 |
+
{"role": "user", "content": user_input}
|
15 |
+
],
|
16 |
)
|
17 |
return response.choices[0].message.content
|
18 |
|
19 |
+
# Gradio chatbot interface
|
20 |
+
chatbot = gr.ChatInterface(
|
21 |
fn=generate_writing_prompt,
|
22 |
+
title="Kreativer Schreibassistent Alex 📝",
|
23 |
+
description="Entfessle deine Kreativität! Chatte mit Alex, um einzigartige Geschichten, Ideen und Plot-Twists zu erhalten.",
|
|
|
|
|
24 |
theme="huggingface",
|
|
|
|
|
|
|
|
|
|
|
25 |
)
|
26 |
|
|
|
27 |
# Launch the interface
|
28 |
if __name__ == "__main__":
|
29 |
+
chatbot.launch()
|