fast72 commited on
Commit
8b97255
·
verified ·
1 Parent(s): 9392271

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +11 -2
server.js CHANGED
@@ -23,12 +23,21 @@ async function transcript(url) {
23
  return text;
24
  }
25
 
26
- app.get('/transcript', async (req, res) => {
27
  const { url } = req.query;
28
  if (!url) return res.status(400).json({ error: 'Missing video URL' });
29
  try {
30
  const rttex = await transcript(url);
31
- res.json(rttex);
 
 
 
 
 
 
 
 
 
32
  } catch (error) {
33
  console.log(error);
34
  res.status(500).json({ error: 'Failed to fetch transcript' });
 
23
  return text;
24
  }
25
 
26
+ app.get('/summary', async (req, res) => {
27
  const { url } = req.query;
28
  if (!url) return res.status(400).json({ error: 'Missing video URL' });
29
  try {
30
  const rttex = await transcript(url);
31
+ const { data } = await axios.post('https://fast72-deepseek.hf.space/chat', {
32
+ body: {
33
+ sessionId: url,
34
+ message: 'Summary this message: ' + rttex?.trim(),
35
+ temperature: 0.2,
36
+ system: `Your task is to accurately summarize the given text while preserving its original language. The summary must be concise yet retain all essential information. Once the summary is complete, send it immediately without any extra commentary. The output must be a true summary, not a reworded version of the full text.`
37
+ }
38
+ });
39
+ const result = data?.includes('</think>') ? data?.split('</think>')[1] : data;
40
+ res.send(data?.trim());
41
  } catch (error) {
42
  console.log(error);
43
  res.status(500).json({ error: 'Failed to fetch transcript' });