Spaces:
Runtime error
Runtime error
Download app.py from Subbu1304/newproject: direct link, hf CLI and curl.
- Browser
- Download file 852 Bytes
-
https://huggingface.co/spaces/Subbu1304/newproject/resolve/main/app.py
- Command line
-
hf download hf://spaces/Subbu1304/newproject/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Subbu1304/newproject/resolve/main/app.py
852 Bytes
| import gradio as gr | |
| from flask import Flask, render_template, request, redirect, url_for | |
| app = Flask(__name__) | |
| # Sample username and password for login | |
| USER_CREDENTIALS = {"username": "user", "password": "pass"} | |
| def home(): | |
| return render_template('login.html') | |
| def login(): | |
| username = request.form['username'] | |
| password = request.form['password'] | |
| if username == USER_CREDENTIALS["username"] and password == USER_CREDENTIALS["password"]: | |
| return redirect(url_for('gradio_app')) | |
| else: | |
| return "Invalid credentials, please try again." | |
| def gradio_app(): | |
| def greet(name): | |
| return f"Hello, {name}!" | |
| interface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| interface.launch() | |
| if __name__ == '__main__': | |
| app.run(debug=True) | |