reach-vb HF staff commited on
Commit
f72cc52
·
1 Parent(s): 642d0a9

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +46 -14
index.html CHANGED
@@ -1,19 +1,51 @@
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
 
 
 
 
 
 
 
 
 
 
 
 
8
  </head>
9
  <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto&display=swap" >
5
+ <style>
6
+ body {
7
+ font-family: 'Roboto', sans-serif;
8
+ font-size: 16px;
9
+ }
10
+ .logo {
11
+ height: 1em;
12
+ vertical-align: middle;
13
+ margin-bottom: 0.1em;
14
+ }
15
+ </style>
16
+
17
+ <script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/[email protected]/dist/lite.js"></script>
18
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/[email protected]/dist/lite.css" />
19
+ <link rel="stylesheet" href="https://gradio-hello-world.hf.space/theme.css">
20
  </head>
21
  <body>
22
+ <gradio-lite>
23
+
24
+ <gradio-requirements>
25
+ transformers_js_py
26
+ </gradio-requirements>
27
+
28
+ <gradio-file name="app.py" entrypoint>
29
+ from transformers_js import import_transformers_js
30
+ import gradio as gr
31
+
32
+ transformers = await import_transformers_js()
33
+ pipeline = transformers.pipeline
34
+ pipe = await pipeline('translation', 'Xenova/nllb-200-distilled-600M')
35
+
36
+ async def generate(text):
37
+ return await pipe(text, { src_lang: 'en', tgt_lang: 'fr'})
38
+
39
+ demo = gr.Interface(
40
+ generate,
41
+ gr.Textbox(label="English Text"),
42
+ gr.JSON(label="Translated Text"),
43
+ examples=["My name is VB and I live in Stuttgart.", "I like eating Maultaschen and Wurst.", "Can I have a pain au chocolate, please?"],
44
+ theme=gr.themes.Soft(),
45
+ flag=False)
46
+ demo.launch()
47
+ </gradio-file>
48
+
49
+ </gradio-lite>
50
+ </body>
51
+ </html>