knowsuchagency commited on
Commit
63b6d33
1 Parent(s): 4c6f82c

feat: Update Gradio interface configuration with description and transcript output

Browse files
Files changed (1) hide show
  1. README.md +0 -71
README.md CHANGED
@@ -55,77 +55,6 @@ To set up the project, follow these steps:
55
  5. **Generate Audio:**
56
  Click the button to start the conversion process. The output will be an MP3 file containing the podcast dialogue.
57
 
58
- ## Project Structure
59
-
60
- - **main.py:** Main application script.
61
- - **requirements.txt:** List of dependencies.
62
- - **README.md:** Project documentation (this file).
63
-
64
- ## Code Explanation
65
-
66
- ### Dialogue Models
67
-
68
- Defines the structure of the dialogue using Pydantic models.
69
-
70
- ```python
71
- class DialogueItem(BaseModel):
72
- text: str
73
- voice: Literal["alloy", "onyx", "fable"]
74
-
75
- class Dialogue(BaseModel):
76
- scratchpad: str
77
- dialogue: List[DialogueItem]
78
- ```
79
-
80
- ### LLM Function
81
-
82
- Generates dialogue based on the input text using the `promptic` decorator.
83
-
84
- ```python
85
- @llm(model="gemini/gemini-1.5-flash")
86
- def generate_dialogue(text: str) -> Dialogue:
87
- # Function to generate podcast dialogue
88
- ```
89
-
90
- ### TTS Function
91
-
92
- Converts text to speech using OpenAI's text-to-speech model.
93
-
94
- ```python
95
- def get_mp3(text: str, voice: str, api_key: str = None) -> bytes:
96
- # Function to generate MP3 from text
97
- ```
98
-
99
- ### Main Function
100
-
101
- Processes the PDF, generates dialogue, and converts it to audio.
102
-
103
- ```python
104
- def generate_audio(file: bytes, openai_api_key: str) -> bytes:
105
- # Main function to process PDF and generate audio
106
- ```
107
-
108
- ### Gradio Interface
109
-
110
- Creates a user-friendly interface for uploading PDFs and generating podcasts.
111
-
112
- ```python
113
- demo = gr.Interface(
114
- title="PDF to Podcast",
115
- description="Convert any PDF document into an engaging podcast episode!",
116
- fn=generate_audio,
117
- inputs=[
118
- gr.File(label="Input PDF", type="binary"),
119
- gr.Textbox(label="OpenAI API Key", placeholder="Enter your OpenAI API key here"),
120
- ],
121
- outputs=[
122
- gr.Audio(format="mp3"),
123
- ],
124
- )
125
-
126
- demo.launch(show_api=False)
127
- ```
128
-
129
  ## License
130
 
131
  This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for more information.
 
55
  5. **Generate Audio:**
56
  Click the button to start the conversion process. The output will be an MP3 file containing the podcast dialogue.
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  ## License
59
 
60
  This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for more information.