ValMar2024 commited on
Commit
b665b40
·
verified ·
1 Parent(s): ff1ad65

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -32
app.py DELETED
@@ -1,32 +0,0 @@
1
- import gradio as gr
2
- import whisper
3
- import openai
4
-
5
- # Setează cheia ta OpenAI (înlocuiește YOUR_API_KEY cu cheia ta reală)
6
- openai.api_key = "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"
7
-
8
- # Încarcă modelul Whisper
9
- model = whisper.load_model("base")
10
-
11
- def proceseaza_audio(file):
12
- # Transcriere audio folosind Whisper
13
- result = model.transcribe(file.name)
14
- transcript = result["text"]
15
-
16
- # Generare rezumat folosind OpenAI
17
- completare = openai.ChatCompletion.create(
18
- model="gpt-4",
19
- messages=[
20
- {"role": "system", "content": "Ești un asistent care rezumă conținut."},
21
- {"role": "user", "content": transcript}
22
- ]
23
- )
24
- rezumat = completare.choices[0].message.content
25
- return transcript, rezumat
26
-
27
- # Interfață Gradio
28
- inputs = gr.Audio(type="filepath")
29
- outputs = [gr.Textbox(label="Transcrierea textului"), gr.Textbox(label="Rezumatul textului")]
30
-
31
- app = gr.Interface(fn=proceseaza_audio, inputs=inputs, outputs=outputs, title="Transcriere și Rezumat AI")
32
- app.launch()