Files changed (1) hide show
  1. app.py +9 -19
app.py CHANGED
@@ -1,22 +1,12 @@
1
- import sys
2
- import numpy as np
3
- import gradio as gr
4
- import requests
5
 
 
 
 
6
 
 
7
 
8
- def greet(payload):
9
- response = requests.post("https://api-inference.huggingface.co/models/PoseyATX/Moist-Pony", headers={"Authorization": "Bearer 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"}, json=payload)
10
- return response.json()
11
- super().load(name=PoseyATX/Moist-Pony, src=huggingface, api_key=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, alias=BillWork, **kwargs)
12
- output = greet({
13
- "inputs": "The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.",
14
- })
15
-
16
- with gr.Blocks() as demo:
17
- name = gr.Textbox(label="Paste Your Bill Text In Here:")
18
- output = gr.Textbox(label="Analysis")
19
- greet_btn = gr.Button("ANALYZE")
20
- greet_btn.click(fn=greet, inputs=name, outputs=output)
21
-
22
- demo.launch("share=True")
 
1
+ >>> from transformers import GPTNeoForCausalLM, GPT2Tokenizer
2
+ >>> model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")
3
+ >>> tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
 
4
 
5
+ >>> prompt = "In a shocking finding, scientists discovered a herd of unicorns living in a remote, " \
6
+ ... "previously unexplored valley, in the Andes Mountains. Even more surprising to the " \
7
+ ... "researchers was the fact that the unicorns spoke perfect English."
8
 
9
+ >>> input_ids = tokenizer(prompt, return_tensors="pt").input_ids
10
 
11
+ >>> gen_tokens = model.generate(input_ids, do_sample=True, temperature=0.9, max_length=100,)
12
+ >>> gen_text = tokenizer.batch_decode(gen_tokens)[0]