Pepguy commited on
Commit
f47518c
·
verified ·
1 Parent(s): 420689c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -28
app.py CHANGED
@@ -1,31 +1,13 @@
1
- from fastapi import FastAPI
2
- from pyannote.audio.pipelines import SpeakerDiarization
3
- import os
4
- from pyannote.core import Segment
5
- import torch
6
 
7
- app = FastAPI()
 
8
 
9
- @app.get("/")
10
- def read_root():
11
- auth_token = os.getenv('ID')
12
- if auth_token is None:
13
- return {"error": "ID environment variable not set"}
14
-
15
- print(auth_token)
16
-
17
- # Load the speaker diarization model using the token
18
- pipeline = SpeakerDiarization.from_pretrained(
19
- "pyannote/speaker-diarization",
20
- use_auth_token="hf_" + auth_token
21
- )
22
 
23
- # Apply diarization on the sample audio file
24
- diarization = pipeline("sample.mp3")
25
-
26
- # Print speaker segments
27
- for turn, _, speaker in diarization.itertracks(yield_label=True):
28
- print(f"Speaker {speaker}: {turn.start:.1f}s --> {turn.end:.1f}s")
29
-
30
- return {"Hello": "World!"}
31
-
 
1
+ const express = require('express');
2
+ const path = require('path');
3
+ const app = express();
 
 
4
 
5
+ // Serve static files from the 'public' directory
6
+ app.use(express.static(path.join(__dirname, 'public')));
7
 
8
+ // ... your other routes and middleware ...
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ const port = 7860;
11
+ app.listen(port, () => {
12
+ console.log(`Server running on port ${port}`);
13
+ });