File size: 456 Bytes
a1fb2a8
47eda2c
a1fb2a8
383edc3
 
 
 
 
 
 
a1fb2a8
 
383edc3
a1fb2a8
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import pipeline, AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(
      'vitaliy-sharandin/wiseai',
      load_in_8bit=True,
      device_map = {"": 0}
  )

pipe = pipeline('text-generation', model=model)

def generate_text(prompt):
    result = pipe(prompt, max_length=200)
    return result[0]['generated_text']

iface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
iface.launch()