smjain commited on
Commit
0588585
1 Parent(s): 67c2a50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -25
app.py CHANGED
@@ -1,28 +1,21 @@
1
- from flask import Flask, request, jsonify
2
 
3
- app = Flask(__name__)
 
 
 
4
 
5
- @app.route('/process_audio', methods=['POST'])
6
- def process_audio():
7
- # Check if a file is part of the request
8
- if 'audio_file' not in request.files:
9
- return jsonify(error="Audio file is missing."), 400
 
 
 
 
 
10
 
11
- audio_file = request.files['audio_file']
12
- # You may want to save the file or process it here
13
-
14
- # Extract string parameters
15
- param1 = request.form.get('param1', '')
16
- param2 = request.form.get('param2', '')
17
-
18
- # Example processing logic
19
- response = {
20
- 'message': 'File received',
21
- 'param1': param1,
22
- 'param2': param2
23
- }
24
-
25
- return jsonify(response), 200
26
-
27
- if __name__ == '__main__':
28
- app.run(debug=True, host='0.0.0.0', port=8000)
 
1
+ import gradio as gr
2
 
3
+ def process_audio_and_strings(audio_file, string1, string2):
4
+ # This function would process the audio file and strings as needed.
5
+ # For demonstration, it just returns a confirmation message.
6
+ return f"Received audio file: {audio_file.name}, and strings: '{string1}', '{string2}'"
7
 
8
+ # Define the Gradio interface
9
+ iface = gr.Interface(
10
+ fn=process_audio_and_strings,
11
+ inputs=[
12
+ gr.Audio(source="upload", type="file"),
13
+ gr.Textbox(label="String 1"),
14
+ gr.Textbox(label="String 2")
15
+ ],
16
+ outputs="text"
17
+ )
18
 
19
+ # Launch the app
20
+ if __name__ == "__main__":
21
+ iface.launch()