-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemp.txt
62 lines (48 loc) · 1.88 KB
/
temp.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
flask
tempeletes ____---- index.html
prediction page
css
git ::::
echo "# Dog-Breed-Classification" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/AwnishRanjan/Dog-Breed-Classification.git
git push -u origin main
## 10 epoches alreday train so start initial epoches as 10 to 50
---------------------------------------------------------------------------------------------------------
from fastapi import FastAPI, UploadFile, File
import logging
from fastapi import FastAPI, UploadFile, File, Depends
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = ["http://localhost:8080", "http://127.0.0.1:5500"] # Replace with your frontend URL(s)
app.add_middleware(
CORSMiddleware,
allow_origins="*",
allow_credentials=True,
allow_methods="*",
allow_headers=["*"],
)
@app.post("/test")
async def process_audio(file: UploadFile = File(...)):
try:
# Read file data
file_data = await file.read()
with open("converted.mp3", "wb") as f:
f.write(file_data)
with open('converted.mp3', 'rb') as audio_file:
transcription = client.audio.transcriptions.create(model="whisper-1", file=audio_file)
print(transcription.text)
prompt = f"Tell me only the medical details from the next paragraph (if there are no medical details in it, just say no medical details available and if available list those) and summarize it in brief 3 - 4 points,{transcription.text}"
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": prompt},
]
)
return {"summary": completion.choices[0].message.content}
except Exception as e:
logging.error("Error processing audio: %s", e)
return {}