Ferhat123 commited on
Commit
98f9b38
1 Parent(s): ffc8241

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import AutoTokenizer, AutoModelForCausalLM
3
+
4
+ model_name = "meta-llama/Meta-Llama-3-8B"
5
+
6
+ # Tokenizer ve modeli Hugging Face'den yükleyin
7
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
8
+ model = AutoModelForCausalLM.from_pretrained(model_name)
9
+
10
+ # Streamlit arayüzünü oluşturma
11
+ st.title("Text Generation with LLaMA 3 8B")
12
+ prompt = st.text_input("Enter your prompt:")
13
+
14
+ if st.button("Generate"):
15
+ inputs = tokenizer(prompt, return_tensors="pt")
16
+ outputs = model.generate(inputs["input_ids"], max_length=100)
17
+ generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
18
+ st.text_area("Generated Text", value=generated_text, height=200)