my-second-app / index.html
marium-a's picture
Update index.html
8f24cba verified
Raw
History Blame Contribute Delete
1.86 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gradio Lite Test</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.css" />
<style>
html, body {
height: 100%;
margin: 0;
}
gradio-lite {
display: block;
height: 100%;
}
</style>
</head>
<body>
<gradio-lite>
<!-- CRITICAL FIX: Lock down both versions to prevent the upstream Wasm wheel crash -->
<gradio-requirements>
gradio==4.44.1
huggingface_hub==0.33.5
</gradio-requirements>
<gradio-file name="app.py" entrypoint>
# ------------------------------------------------------------------
# Workaround for Starlette expecting query_string as bytes
# ------------------------------------------------------------------
import starlette.datastructures as _sd
_original_init = _sd.URL.__init__
def _patched_init(self, url="", scope=None, **kwargs):
if scope is not None:
scope = dict(scope)
qs = scope.get("query_string")
if isinstance(qs, str):
scope["query_string"] = qs.encode("latin-1")
return _original_init(self, url=url, scope=scope, **kwargs)
_sd.URL.__init__ = _patched_init
# ------------------------------------------------------------------
# Gradio app
# ------------------------------------------------------------------
import gradio as gr
def respond(message, history):
response = f"You said: {message}\nAnd I say I love learning AI Engineering with SuperDataScience!"
return response
gr.ChatInterface(fn=respond).launch()
</gradio-file>
</gradio-lite>
</body>
</html>