Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,6 +30,29 @@ def listen():
|
|
| 30 |
print("Sorry, the speech recognition service is down.")
|
| 31 |
return None
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# Define the function for Gradio interface
|
| 34 |
def voice_login():
|
| 35 |
speak("Welcome to Briyani Hub!")
|
|
@@ -45,11 +68,16 @@ def voice_login():
|
|
| 45 |
if gmail:
|
| 46 |
speak(f"You said your Gmail is {gmail}.")
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
# Define Gradio interface
|
| 52 |
-
iface = gr.Interface(fn=voice_login,
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# Launch the interface
|
| 55 |
iface.launch()
|
|
|
|
| 30 |
print("Sorry, the speech recognition service is down.")
|
| 31 |
return None
|
| 32 |
|
| 33 |
+
# Function to save HTML file temporarily
|
| 34 |
+
def save_html(name, gmail):
|
| 35 |
+
html_content = f"""
|
| 36 |
+
<!DOCTYPE html>
|
| 37 |
+
<html lang="en">
|
| 38 |
+
<head>
|
| 39 |
+
<meta charset="UTF-8">
|
| 40 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 41 |
+
<title>Briyani Hub Login</title>
|
| 42 |
+
</head>
|
| 43 |
+
<body>
|
| 44 |
+
<h1>Welcome to Briyani Hub</h1>
|
| 45 |
+
<p>Your Name: {name}</p>
|
| 46 |
+
<p>Your Gmail: {gmail}</p>
|
| 47 |
+
</body>
|
| 48 |
+
</html>
|
| 49 |
+
"""
|
| 50 |
+
# Save the HTML file temporarily in the current directory
|
| 51 |
+
file_name = "login_details.html"
|
| 52 |
+
with open(file_name, "w") as file:
|
| 53 |
+
file.write(html_content)
|
| 54 |
+
return file_name
|
| 55 |
+
|
| 56 |
# Define the function for Gradio interface
|
| 57 |
def voice_login():
|
| 58 |
speak("Welcome to Briyani Hub!")
|
|
|
|
| 68 |
if gmail:
|
| 69 |
speak(f"You said your Gmail is {gmail}.")
|
| 70 |
|
| 71 |
+
# Save HTML with captured name and gmail
|
| 72 |
+
file_path = save_html(name, gmail)
|
| 73 |
+
|
| 74 |
+
# Return the HTML file path for download
|
| 75 |
+
return file_path
|
| 76 |
|
| 77 |
+
# Define Gradio interface to allow users to download the HTML file
|
| 78 |
+
iface = gr.Interface(fn=voice_login,
|
| 79 |
+
inputs=[],
|
| 80 |
+
outputs=gr.File(label="Download Your HTML File"))
|
| 81 |
|
| 82 |
# Launch the interface
|
| 83 |
iface.launch()
|