shukdevdatta123 commited on
Commit
6ddcaf4
·
verified ·
1 Parent(s): 7490b42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -39
app.py CHANGED
@@ -4,8 +4,6 @@ import numpy as np
4
  from PIL import Image
5
  from pytube import YouTube
6
  import demoji
7
- import sounddevice
8
- from scipy.io.wavfile import write
9
  from textblob import TextBlob
10
  from faker import Faker
11
  import pandas as pd
@@ -55,23 +53,6 @@ def detect_emojis(text):
55
  else:
56
  return "No emojis found in the text"
57
 
58
- # Function for Voice Recording
59
- def record_voice(seconds):
60
- if seconds <= 0:
61
- return "Please enter a positive number of seconds"
62
-
63
- try:
64
- fs = 44100 # Sample rate
65
- recording = sounddevice.rec(int(seconds * fs), samplerate=fs, channels=2)
66
- sounddevice.wait()
67
-
68
- output_file = "recording.wav"
69
- write(output_file, fs, recording)
70
-
71
- return f"Recording completed! Saved as {output_file}", output_file
72
- except Exception as e:
73
- return f"Error recording: {str(e)}", None
74
-
75
  # Function for Spell Correction
76
  def correct_spelling(text):
77
  if not text:
@@ -197,26 +178,6 @@ with gr.Blocks(title="MultiToolBox") as app:
197
  **Example:** "I love reading books 📚❤️🌹"
198
  """)
199
 
200
- # Voice Recorder Tab
201
- with gr.Tab("Voice Recorder"):
202
- gr.Markdown("### Record Audio")
203
- rec_seconds = gr.Number(label="Recording Duration (seconds)", value=5)
204
- rec_button = gr.Button("Start Recording")
205
- rec_output = gr.Textbox(label="Recording Status")
206
- audio_output = gr.Audio(label="Recorded Audio")
207
-
208
- rec_button.click(fn=record_voice, inputs=rec_seconds, outputs=[rec_output, audio_output])
209
-
210
- gr.Markdown("""
211
- **How to use:**
212
- 1. Enter the desired recording duration in seconds
213
- 2. Click "Start Recording"
214
- 3. Wait for the recording to complete
215
- 4. Play back the recorded audio using the player
216
-
217
- **Example:** Enter 5 for a 5-second recording
218
- """)
219
-
220
  # Spell Correction Tab
221
  with gr.Tab("Spell Checker"):
222
  gr.Markdown("### Correct Spelling Errors")
 
4
  from PIL import Image
5
  from pytube import YouTube
6
  import demoji
 
 
7
  from textblob import TextBlob
8
  from faker import Faker
9
  import pandas as pd
 
53
  else:
54
  return "No emojis found in the text"
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  # Function for Spell Correction
57
  def correct_spelling(text):
58
  if not text:
 
178
  **Example:** "I love reading books 📚❤️🌹"
179
  """)
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  # Spell Correction Tab
182
  with gr.Tab("Spell Checker"):
183
  gr.Markdown("### Correct Spelling Errors")