Spaces:
Sleeping
Sleeping
File size: 3,373 Bytes
3553d38 8c3bd05 3553d38 8c3bd05 3553d38 8c3bd05 3553d38 8c3bd05 814a298 8c3bd05 3553d38 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gradio to Flask Converter</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body { background-color: #f0f2f5; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.container { max-width: 1200px; margin: 50px auto; padding: 30px; background: white; border-radius: 15px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
h1 { color: #2c3e50; text-align: center; margin-bottom: 30px; }
textarea { min-height: 300px; resize: vertical; }
.btn-submit { background-color: #3498db; border: none; padding: 10px 20px; }
.btn-submit:hover { background-color: #2980b9; }
.error { color: #e74c3c; margin-top: 20px; text-align: center; }
.result-section { margin-top: 40px; }
.file-section { margin-bottom: 30px; }
pre { background: #f8f9fa; padding: 15px; border-radius: 5px; max-height: 400px; overflow-y: auto; }
.btn-download { margin-top: 10px; }
</style>
</head>
<body>
<div class="container">
<h1>Convert Gradio to Flask</h1>
<form method="POST">
<div class="mb-3">
<label for="gradio_script" class="form-label">Paste Your Gradio Script Here:</label>
<textarea class="form-control" id="gradio_script" name="gradio_script" placeholder="import gradio as gr\n..." required>{{ gradio_script }}</textarea>
</div>
<button type="submit" class="btn btn-primary btn-submit">Convert & Download</button>
</form>
{% if error %}
<div class="error">{{ error }}</div>
{% endif %}
{% if result %}
<div class="result-section">
<h2>Conversion Result</h2>
<div class="file-section">
<h3>app.py</h3>
<pre>{{ result.flask_code }}</pre>
<a href="/download/app.py?content={{ result.flask_code|urlencode }}" class="btn btn-primary btn-download">Download app.py</a>
</div>
<div class="file-section">
<h3>templates/index.html</h3>
<pre>{{ result.html_template }}</pre>
<a href="/download/index.html?content={{ result.html_template|urlencode }}" class="btn btn-primary btn-download">Download index.html</a>
</div>
<div class="file-section">
<h3>requirements.txt</h3>
<pre>{{ result.requirements }}</pre>
<a href="/download/requirements.txt?content={{ result.requirements|urlencode }}" class="btn btn-primary btn-download">Download requirements.txt</a>
</div>
<div class="file-section">
<h3>Download All</h3>
<a href="/download/zip?content={{ result.zip_base64|urlencode }}" class="btn btn-success btn-download">Download ZIP</a>
</div>
</div>
{% endif %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html> |