burask commited on
Commit
d77c502
·
verified ·
1 Parent(s): fa2c805

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -18
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from flask import Flask, render_template, request, jsonify
2
  import os
3
  import subprocess
4
  from speech_recognition import Recognizer, AudioFile
@@ -16,9 +16,6 @@ tokenizer = AutoTokenizer.from_pretrained("csebuetnlp/mT5_multilingual_XLSum", u
16
  model = AutoModelForSeq2SeqLM.from_pretrained("csebuetnlp/mT5_multilingual_XLSum")
17
  punct_model = PunctuationModel(model="oliverguhr/fullstop-punctuation-multilingual-sonar-base")
18
 
19
- # İlerleme durumunu tutacak değişken
20
- upload_progress = 0
21
-
22
  def metin_duzenleme(text):
23
  text = text.strip()
24
  try:
@@ -59,10 +56,7 @@ def ses_donusturucu(wav_path):
59
 
60
  @app.route("/", methods=["GET", "POST"])
61
  def index():
62
- global upload_progress
63
  if request.method == "POST":
64
- upload_progress = 10 # Yükleme başladı
65
-
66
  if "file" not in request.files:
67
  return "Dosya bulunamadı."
68
  file = request.files["file"]
@@ -72,26 +66,15 @@ def index():
72
  filename = secure_filename(file.filename)
73
  file_path = os.path.join(app.config["yuklenen_dosyalar"], filename)
74
  file.save(file_path)
75
- upload_progress = 40 # Dosya kaydedildi
76
 
77
  wav_path = convert_mp3_to_wav(file_path)
78
- upload_progress = 60 # Dönüştürme tamamlandı
79
-
80
  raw_text = ses_donusturucu(wav_path)
81
- upload_progress = 80 # Ses tanıma tamamlandı
82
-
83
  metin = metin_duzenleme(raw_text)
84
  ozet = metin_ozetleme(metin)
85
- upload_progress = 100 # Tamamlandı
86
 
87
  return render_template("index.html", metin=metin, ozet=ozet)
88
  return render_template("index.html")
89
 
90
- @app.route("/progress")
91
- def progress():
92
- global upload_progress
93
- return jsonify({"progress": upload_progress})
94
-
95
  if __name__ == "__main__":
96
  if not os.path.exists(yuklenen_dosyalar):
97
  os.makedirs(yuklenen_dosyalar)
 
1
+ from flask import Flask, render_template, request
2
  import os
3
  import subprocess
4
  from speech_recognition import Recognizer, AudioFile
 
16
  model = AutoModelForSeq2SeqLM.from_pretrained("csebuetnlp/mT5_multilingual_XLSum")
17
  punct_model = PunctuationModel(model="oliverguhr/fullstop-punctuation-multilingual-sonar-base")
18
 
 
 
 
19
  def metin_duzenleme(text):
20
  text = text.strip()
21
  try:
 
56
 
57
  @app.route("/", methods=["GET", "POST"])
58
  def index():
 
59
  if request.method == "POST":
 
 
60
  if "file" not in request.files:
61
  return "Dosya bulunamadı."
62
  file = request.files["file"]
 
66
  filename = secure_filename(file.filename)
67
  file_path = os.path.join(app.config["yuklenen_dosyalar"], filename)
68
  file.save(file_path)
 
69
 
70
  wav_path = convert_mp3_to_wav(file_path)
 
 
71
  raw_text = ses_donusturucu(wav_path)
 
 
72
  metin = metin_duzenleme(raw_text)
73
  ozet = metin_ozetleme(metin)
 
74
 
75
  return render_template("index.html", metin=metin, ozet=ozet)
76
  return render_template("index.html")
77
 
 
 
 
 
 
78
  if __name__ == "__main__":
79
  if not os.path.exists(yuklenen_dosyalar):
80
  os.makedirs(yuklenen_dosyalar)