Nojoodalnahdi commited on
Commit
e445db3
1 Parent(s): 5c49c73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -1,21 +1,20 @@
1
  import gradio as gr
2
- from transformers import pipeline
 
3
 
4
- # Load the text generation pipeline from Hugging Face
5
- generator = pipeline("text-generation", model="gpt-2")
 
 
 
6
 
7
- def generate_text(prompt):
8
- # Generate text based on the input prompt
9
- results = generator(prompt, max_length=100, num_return_sequences=1)
10
- return results[0]['generated_text']
11
-
12
- # Create the Gradio interface
13
  iface = gr.Interface(
14
- fn=generate_text,
15
- inputs=gr.inputs.Textbox(label="Input Prompt", lines=2, placeholder="Enter your prompt here..."),
16
- outputs=gr.outputs.Textbox(label="Generated Text"),
17
- title="Text Generation with GPT-2",
18
- description="Enter a prompt and get a generated text using the GPT-2 model from Hugging Face."
19
  )
20
 
21
  # Launch the interface
 
1
  import gradio as gr
2
+ from gtts import gTTS
3
+ import os
4
 
5
+ def greet(name):
6
+ greeting_text = f"Hello, {name}! Welcome to our AI-powered voice greeting system."
7
+ tts = gTTS(text=greeting_text, lang='en')
8
+ tts.save("greeting.mp3")
9
+ return "greeting.mp3"
10
 
11
+ # Create Gradio interface
 
 
 
 
 
12
  iface = gr.Interface(
13
+ fn=greet,
14
+ inputs="text",
15
+ outputs="audio",
16
+ title="AI Voice Greeting",
17
+ description="Enter your name and receive a personalized greeting as an AI-generated voice."
18
  )
19
 
20
  # Launch the interface