File size: 1,091 Bytes
5570fe4
 
58b60ba
 
5570fe4
 
 
 
 
 
feb3923
5570fe4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58b60ba
 
 
5570fe4
58b60ba
5570fe4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Import necessary libraries
from g4f.client import Client
import gradio as gr

# Initialize the G4F client
client = Client()

# Define the function for generating creative writing prompts
def generate_writing_prompt(user_input):
    response = client.chat.completions.create(
        model="gpt-4-turbo",
        messages=[{"role": "user", "content": user_input}],
    )
    return response.choices[0].message.content

# Gradio userinterface...
interface = gr.Interface(
    fn=generate_writing_prompt,
    inputs=gr.Textbox(lines=3, placeholder="Enter a genre, tone, or initial plot point..."),
    outputs="text",
    title="Creative Writing Assistant 📝",
    description="Unleash your creativity! Get inspired with unique story ideas, prompts, and plot twists.",
    theme="huggingface",
    examples=[
        ["A story about a lost civilization discovering technology."],
        ["Compose a poem about the changing seasons."],
        ["A suspense thriller set in an abandoned mansion."],
    ]
)


# Launch the interface
if __name__ == "__main__":
    interface.launch(share=True)