ValMar2024 commited on
Commit
98cc89a
·
verified ·
1 Parent(s): 8551764

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -40
app.py DELETED
@@ -1,40 +0,0 @@
1
- import gradio as gr
2
- import openai
3
- import whisper
4
-
5
- # Load the Whisper model
6
- model = whisper.load_model("base")
7
-
8
- # Function to process audio and generate transcription and summary
9
- def procesare_audio(file):
10
- # Transcribe audio
11
- result = model.transcribe(file.name)
12
- transcriere_text = result["text"]
13
-
14
- # Use OpenAI to summarize the transcription
15
- openai.api_key = "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"
16
- response = openai.ChatCompletion.create(
17
- model="gpt-3.5-turbo",
18
- messages=[
19
- {"role": "system", "content": "You are a helpful assistant that summarizes text."},
20
- {"role": "user", "content": f"Please summarize the following text: {transcriere_text}"}
21
- ]
22
- )
23
- rezumat_text = response.choices[0].message.content.strip()
24
-
25
- return transcriere_text, rezumat_text
26
-
27
- # Define the Gradio interface
28
- interface = gr.Interface(
29
- fn=procesare_audio,
30
- inputs=[gr.Audio(type="filepath")],
31
- outputs=[
32
- gr.Textbox(label="Transcrierea textului:"),
33
- gr.Textbox(label="Rezumatul textului:")
34
- ],
35
- title="Transcriere și Rezumat AI",
36
- description="Această aplicație transcrie fișiere audio și creează un rezumat al conținutului folosind AI.",
37
- )
38
-
39
- # Launch the Gradio app
40
- interface.launch(share=False, debug=True)