sudiptaverse commited on
Commit
4061573
Β·
verified Β·
1 Parent(s): d5cfaf6

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +34 -39
README.md CHANGED
@@ -1,39 +1,34 @@
1
- from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
2
- from langchain_core.prompts import ChatPromptTemplate
3
- from langchain_huggingface import HuggingFacePipeline
4
- from langchain_core.runnables import RunnableSequence
5
- import gradio as gr
6
-
7
- # Load model
8
- model_id = "google/gemma-2b"
9
- tokenizer = AutoTokenizer.from_pretrained(model_id)
10
- model = AutoModelForCausalLM.from_pretrained(model_id)
11
-
12
- # Text generation pipeline
13
- generator = pipeline(
14
- "text-generation",
15
- model=model,
16
- tokenizer=tokenizer,
17
- max_new_tokens=200,
18
- do_sample=True,
19
- temperature=0.7
20
- )
21
-
22
- # LangChain wrapper
23
- llm = HuggingFacePipeline(pipeline=generator)
24
-
25
- # Prompt template
26
- prompt = ChatPromptTemplate.from_messages([
27
- ("system", "You are a helpful assistant. Please respond to the user queries."),
28
- ("user", "Question: {question}")
29
- ])
30
-
31
- # Runnable sequence instead of LLMChain
32
- chain = prompt | llm
33
-
34
- # Gradio interface
35
- def generate_answer(question):
36
- result = chain.invoke({"question": question})
37
- return result
38
-
39
- gr.Interface(fn=generate_answer, inputs="text", outputs="text", title="Gemma 2B Chat").launch()
 
1
+ ---
2
+ title: DataSynth
3
+ emoji: πŸ€–
4
+ colorFrom: indigo
5
+ colorTo: blue # Changed from cyan to blue
6
+ sdk: gradio
7
+ sdk_version: "4.15.0"
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # DataSynth
13
+
14
+ DataSynth is a chatbot built using **Gemma 2B**, integrated via `langchain` and deployed with Gradio.
15
+
16
+ ## πŸš€ Tech Stack
17
+
18
+ | Technology | Description |
19
+ |-------------------|-----------------------------------------|
20
+ | Python | Programming language |
21
+ | Transformers | Model loading and inference |
22
+ | LangChain | Prompt templates and LLM chaining |
23
+ | Gradio | UI framework for interactive demos |
24
+ | Hugging Face Hub | Deployment platform |
25
+
26
+ ## πŸ“ Files
27
+
28
+ - `app.py` β€” Main Gradio app
29
+ - `requirements.txt` β€” Required packages
30
+ - `README.md` β€” Project overview and config
31
+
32
+ ---
33
+
34
+ πŸ”— Try it live on [Hugging Face Spaces](https://huggingface.co/spaces/sudiptaverse/DataSynth)