morningstarxcdcode commited on
Commit
e7478ba
·
verified ·
1 Parent(s): bae25b0

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +5 -8
  2. app.py +30 -0
README.md CHANGED
@@ -1,14 +1,11 @@
1
  ---
2
- title: Adaption Opus 100 Translation Demo
3
- emoji: 🌖
4
- colorFrom: yellow
5
- colorTo: blue
6
  sdk: gradio
7
  sdk_version: 6.19.0
8
- python_version: '3.13'
9
  app_file: app.py
10
- pinned: false
11
  license: apache-2.0
12
  ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Adaption OPUS 100 Translation SFT 31B
3
+ emoji: 🌐
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: gradio
7
  sdk_version: 6.19.0
 
8
  app_file: app.py
9
+ pinned: true
10
  license: apache-2.0
11
  ---
 
 
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
+
4
+ client = InferenceClient()
5
+
6
+ def translate(prompt, max_tokens=256, temperature=0.3, top_p=0.9):
7
+ output = client.text_generation(
8
+ prompt,
9
+ model="google/gemma-4-31B-it",
10
+ max_new_tokens=max_tokens,
11
+ temperature=temperature,
12
+ top_p=top_p,
13
+ )
14
+ return output
15
+
16
+ demo = gr.Interface(
17
+ fn=translate,
18
+ inputs=[
19
+ gr.Textbox(label="Translation Prompt", placeholder="Translate to French: The weather is nice today.", lines=3),
20
+ gr.Slider(minimum=64, maximum=1024, value=256, step=64, label="Max Tokens"),
21
+ gr.Slider(minimum=0.1, maximum=1.0, value=0.3, step=0.05, label="Temperature"),
22
+ gr.Slider(minimum=0.1, maximum=1.0, value=0.9, step=0.05, label="Top P"),
23
+ ],
24
+ outputs=gr.Textbox(label="Translation", lines=6),
25
+ title="Adaption OPUS 100 Translation SFT 31B",
26
+ description="LoRA adapter fine-tuned on 20K parallel translation pairs across 100 languages using Adaption's AutoScientist platform. Base model: Gemma 4 31B.",
27
+ )
28
+
29
+ if __name__ == "__main__":
30
+ demo.launch()