Pooja P commited on
Commit
225a7e5
Β·
1 Parent(s): d2e9f68

used transformer instead of openai

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -30,7 +30,7 @@
30
  from transformers import pipeline
31
  import gradio as gr
32
 
33
- generator = pipeline("text-generation", model="EleutherAI/gpt-neo-125M")
34
 
35
  def clean_topic(topic):
36
  topic = topic.lower()
@@ -40,10 +40,19 @@ def clean_topic(topic):
40
  topic = topic.replace("write a blog about", "").strip()
41
  return topic.capitalize()
42
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  def generate_blog(topic):
44
- topic = clean_topic(topic)
45
- if not topic:
46
- return "Please provide a topic."
47
  prompt = f"""
48
  Write a detailed and engaging blog post about "{topic}".
49
  Include an introduction, 2–3 subheadings with paragraphs, and a conclusion.
 
30
  from transformers import pipeline
31
  import gradio as gr
32
 
33
+ generator = pipeline("text-generation", model="tiiuae/falcon-7b-instruct")
34
 
35
  def clean_topic(topic):
36
  topic = topic.lower()
 
40
  topic = topic.replace("write a blog about", "").strip()
41
  return topic.capitalize()
42
 
43
+ # def generate_blog(topic):
44
+ # topic = clean_topic(topic)
45
+ # if not topic:
46
+ # return "Please provide a topic."
47
+ # prompt = f"""
48
+ # Write a detailed and engaging blog post about "{topic}".
49
+ # Include an introduction, 2–3 subheadings with paragraphs, and a conclusion.
50
+ # Make it informative and conversational.
51
+ # """
52
+ # result = generator(prompt, max_length=700, do_sample=True, temperature=0.7, top_p=0.9)
53
+ # return result[0]['generated_text']
54
+
55
  def generate_blog(topic):
 
 
 
56
  prompt = f"""
57
  Write a detailed and engaging blog post about "{topic}".
58
  Include an introduction, 2–3 subheadings with paragraphs, and a conclusion.