englissi commited on
Commit
abd295e
·
verified ·
1 Parent(s): 1aaeca6

Delete apppp

Browse files
Files changed (1) hide show
  1. apppp +0 -34
apppp DELETED
@@ -1,34 +0,0 @@
1
- import gradio as gr
2
- from transformers import pipeline
3
-
4
- # Step 1: Initialize the text-generation pipeline
5
- pipe = pipeline("text-generation", model="sambanovasystems/SambaLingo-Bulgarian-Base")
6
-
7
- # Step 2: Define a function to generate Bulgarian text and convert it to TTS
8
- def generate_and_speak(prompt):
9
- # Generate text using the model
10
- generated_text = pipe(prompt, max_length=50, num_return_sequences=1)[0]["generated_text"]
11
-
12
- # Placeholder: Simulating TTS (you can replace this with an actual TTS library)
13
- from gtts import gTTS
14
- tts = gTTS(generated_text, lang="bg")
15
- audio_file = "output.mp3"
16
- tts.save(audio_file)
17
-
18
- return generated_text, audio_file
19
-
20
- # Step 3: Create Gradio interface
21
- with gr.Blocks() as demo:
22
- gr.Markdown("## Bulgarian Text Generator and TTS")
23
- with gr.Row():
24
- input_prompt = gr.Textbox(label="Enter a prompt in Bulgarian:")
25
- with gr.Column():
26
- output_text = gr.Textbox(label="Generated Text")
27
- output_audio = gr.Audio(label="Generated Speech", type="filepath") # Changed "file" to "filepath"
28
- generate_button = gr.Button("Generate")
29
-
30
- generate_button.click(generate_and_speak, inputs=input_prompt, outputs=[output_text, output_audio])
31
-
32
- # Run the app
33
- if __name__ == "__main__":
34
- demo.launch()