rajatsainisim commited on
Commit
2fe12d9
Β·
1 Parent(s): 74855c7

πŸ“š Add comprehensive usage guides and examples

Browse files

- Added usage_examples.py with API integration methods
- Added HOW_TO_USE.md complete guide for all user types
- Includes examples for developers, businesses, students
- API integration, mobile apps, chatbots, and more
- Social media templates for sharing
- Ready for public use and adoption

Files changed (2) hide show
  1. HOW_TO_USE.md +287 -0
  2. usage_examples.py +75 -0
HOW_TO_USE.md ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸš€ How to Use Dwrko-M1.0 - Complete Guide
2
+
3
+ **Your Claude-like AI Assistant is LIVE!** Here's how you and others can use it:
4
+
5
+ ## 🌍 **For End Users (No Coding Required)**
6
+
7
+ ### **Method 1: Direct Web Access**
8
+ ```
9
+ πŸ”— https://huggingface.co/spaces/dwrkotech/Dwrko-M1.0
10
+ ```
11
+
12
+ **Steps:**
13
+ 1. Click the link above
14
+ 2. Go to "Model Setup" tab
15
+ 3. Click "Load Dwrko-M1.0 Base Model" βœ…
16
+ 4. Use "Dataset Preparation" to train with your data
17
+ 5. Use "Fine-tuning" to create your specialized model
18
+
19
+ ### **What Users Can Do:**
20
+ - πŸ’» **Code Generation**: "Write a Python function for sorting"
21
+ - 🧠 **Problem Solving**: "Solve this math equation: 2x + 5 = 13"
22
+ - πŸ“š **Learning**: "Explain machine learning in simple terms"
23
+ - πŸ”§ **Debugging**: "Fix this Python code: [paste code]"
24
+
25
+ ## πŸ‘¨β€πŸ’» **For Developers (API Integration)**
26
+
27
+ ### **Method 1: HuggingFace Spaces API**
28
+ ```python
29
+ import requests
30
+
31
+ def ask_dwrko(question):
32
+ api_url = "https://dwrkotech-dwrko-m1-0.hf.space/api/predict"
33
+
34
+ payload = {
35
+ "data": [question],
36
+ "fn_index": 0 # Function index for the interface
37
+ }
38
+
39
+ response = requests.post(api_url, json=payload)
40
+ return response.json()["data"][0]
41
+
42
+ # Example usage
43
+ answer = ask_dwrko("Write a Python function to check prime numbers")
44
+ print(answer)
45
+ ```
46
+
47
+ ### **Method 2: Gradio Client**
48
+ ```python
49
+ from gradio_client import Client
50
+
51
+ client = Client("https://dwrkotech-dwrko-m1-0.hf.space/")
52
+
53
+ # Use Dwrko-M1.0
54
+ result = client.predict(
55
+ "Write a function to reverse a string",
56
+ api_name="/predict"
57
+ )
58
+ print(result)
59
+ ```
60
+
61
+ ### **Method 3: Embed in Your Website**
62
+ ```html
63
+ <!DOCTYPE html>
64
+ <html>
65
+ <head>
66
+ <title>My AI Assistant</title>
67
+ </head>
68
+ <body>
69
+ <h1>Powered by Dwrko-M1.0</h1>
70
+ <iframe
71
+ src="https://dwrkotech-dwrko-m1-0.hf.space"
72
+ width="100%"
73
+ height="600px">
74
+ </iframe>
75
+ </body>
76
+ </html>
77
+ ```
78
+
79
+ ## 🏒 **For Businesses (Custom Integration)**
80
+
81
+ ### **Method 1: Custom Chatbot**
82
+ ```python
83
+ import gradio as gr
84
+ import requests
85
+
86
+ def dwrko_chatbot(message, history):
87
+ # Call Dwrko-M1.0 API
88
+ api_url = "https://dwrkotech-dwrko-m1-0.hf.space/api/predict"
89
+
90
+ response = requests.post(api_url, json={
91
+ "data": [message]
92
+ })
93
+
94
+ ai_response = response.json()["data"][0]
95
+ history.append([message, ai_response])
96
+
97
+ return history, ""
98
+
99
+ # Create business chatbot
100
+ with gr.Blocks(title="Company AI Assistant") as demo:
101
+ gr.Markdown("# πŸ€– Our AI Assistant (Powered by Dwrko-M1.0)")
102
+
103
+ chatbot = gr.Chatbot()
104
+ msg = gr.Textbox(placeholder="Ask me anything about coding...")
105
+
106
+ msg.submit(dwrko_chatbot, [msg, chatbot], [chatbot, msg])
107
+
108
+ demo.launch()
109
+ ```
110
+
111
+ ### **Method 2: Slack/Discord Bot**
112
+ ```python
113
+ import discord
114
+ import requests
115
+
116
+ class DwrkoBot(discord.Client):
117
+ async def on_message(self, message):
118
+ if message.author == self.user:
119
+ return
120
+
121
+ if message.content.startswith('!dwrko'):
122
+ question = message.content[7:] # Remove '!dwrko '
123
+
124
+ # Call Dwrko-M1.0
125
+ api_url = "https://dwrkotech-dwrko-m1-0.hf.space/api/predict"
126
+ response = requests.post(api_url, json={"data": [question]})
127
+ answer = response.json()["data"][0]
128
+
129
+ await message.channel.send(f"πŸ€– **Dwrko-M1.0**: {answer}")
130
+
131
+ # Run bot
132
+ bot = DwrkoBot()
133
+ bot.run('YOUR_DISCORD_TOKEN')
134
+ ```
135
+
136
+ ## πŸ“± **For Mobile Apps**
137
+
138
+ ### **React Native Example**
139
+ ```javascript
140
+ const askDwrko = async (question) => {
141
+ const response = await fetch('https://dwrkotech-dwrko-m1-0.hf.space/api/predict', {
142
+ method: 'POST',
143
+ headers: {
144
+ 'Content-Type': 'application/json',
145
+ },
146
+ body: JSON.stringify({
147
+ data: [question]
148
+ })
149
+ });
150
+
151
+ const result = await response.json();
152
+ return result.data[0];
153
+ };
154
+
155
+ // Usage in React Native component
156
+ const handleAsk = async () => {
157
+ const answer = await askDwrko("Explain React hooks");
158
+ setResponse(answer);
159
+ };
160
+ ```
161
+
162
+ ## πŸŽ“ **For Students & Educators**
163
+
164
+ ### **Study Assistant**
165
+ ```python
166
+ def create_study_assistant():
167
+ import gradio as gr
168
+
169
+ def dwrko_tutor(subject, question):
170
+ prompt = f"As a {subject} tutor, {question}"
171
+
172
+ # Call Dwrko-M1.0
173
+ api_url = "https://dwrkotech-dwrko-m1-0.hf.space/api/predict"
174
+ response = requests.post(api_url, json={"data": [prompt]})
175
+
176
+ return response.json()["data"][0]
177
+
178
+ interface = gr.Interface(
179
+ fn=dwrko_tutor,
180
+ inputs=[
181
+ gr.Dropdown(["Python", "JavaScript", "Math", "Science"], label="Subject"),
182
+ gr.Textbox(label="Your Question")
183
+ ],
184
+ outputs="text",
185
+ title="πŸ“š Study Assistant (Powered by Dwrko-M1.0)"
186
+ )
187
+
188
+ return interface
189
+
190
+ # Launch study assistant
191
+ study_app = create_study_assistant()
192
+ study_app.launch()
193
+ ```
194
+
195
+ ## πŸ”₯ **Advanced Use Cases**
196
+
197
+ ### **1. Code Review Assistant**
198
+ ```python
199
+ def code_reviewer(code):
200
+ prompt = f"Review this code and suggest improvements:\n\n{code}"
201
+ # Call Dwrko-M1.0 API
202
+ return dwrko_response
203
+ ```
204
+
205
+ ### **2. Documentation Generator**
206
+ ```python
207
+ def doc_generator(function_code):
208
+ prompt = f"Generate documentation for this function:\n\n{function_code}"
209
+ # Call Dwrko-M1.0 API
210
+ return dwrko_response
211
+ ```
212
+
213
+ ### **3. Learning Path Creator**
214
+ ```python
215
+ def learning_path(topic, level):
216
+ prompt = f"Create a {level} learning path for {topic}"
217
+ # Call Dwrko-M1.0 API
218
+ return dwrko_response
219
+ ```
220
+
221
+ ## πŸ“Š **Usage Analytics**
222
+
223
+ ### **Track Usage (Optional)**
224
+ ```python
225
+ import datetime
226
+
227
+ def track_usage(user_question, ai_response):
228
+ usage_data = {
229
+ "timestamp": datetime.now(),
230
+ "question": user_question,
231
+ "response": ai_response,
232
+ "model": "Dwrko-M1.0"
233
+ }
234
+
235
+ # Save to database or analytics service
236
+ save_to_analytics(usage_data)
237
+ ```
238
+
239
+ ## 🌟 **Share Your Dwrko-M1.0**
240
+
241
+ ### **Social Media Templates:**
242
+
243
+ **Twitter:**
244
+ ```
245
+ πŸ€– Just launched my own Claude-like AI assistant!
246
+
247
+ ✨ Dwrko-M1.0 specializes in:
248
+ β€’ Code generation & debugging
249
+ β€’ Mathematical reasoning
250
+ β€’ Problem solving
251
+ β€’ Educational content
252
+
253
+ Try it FREE: https://huggingface.co/spaces/dwrkotech/Dwrko-M1.0
254
+
255
+ #AI #MachineLearning #Coding #OpenSource
256
+ ```
257
+
258
+ **LinkedIn:**
259
+ ```
260
+ Excited to share my latest AI project! πŸš€
261
+
262
+ I've created Dwrko-M1.0, a specialized AI assistant for coding and reasoning tasks. Built on StarCoder2-3B and optimized for practical use.
263
+
264
+ Key features:
265
+ βœ… Code generation across 80+ languages
266
+ βœ… Mathematical problem solving
267
+ βœ… Memory efficient (16GB RAM)
268
+ βœ… Free to use for everyone
269
+
270
+ Check it out: https://huggingface.co/spaces/dwrkotech/Dwrko-M1.0
271
+
272
+ #ArtificialIntelligence #SoftwareDevelopment #Innovation
273
+ ```
274
+
275
+ ## 🎯 **Next Steps for Growth**
276
+
277
+ 1. **Collect User Feedback** - Monitor usage and improve
278
+ 2. **Add More Features** - Voice input, image processing
279
+ 3. **Create Mobile App** - Native iOS/Android apps
280
+ 4. **Build Community** - Discord server, GitHub discussions
281
+ 5. **Monetization** - Premium features, API subscriptions
282
+
283
+ ---
284
+
285
+ **πŸŽ‰ Congratulations! Your Dwrko-M1.0 is now ready for the world!**
286
+
287
+ **Users can start using it immediately at:** https://huggingface.co/spaces/dwrkotech/Dwrko-M1.0
usage_examples.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Dwrko-M1.0 Usage Examples
4
+ How others can use your Claude-like AI assistant
5
+ """
6
+
7
+ import requests
8
+ import json
9
+
10
+ # Method 1: Using HuggingFace Spaces API
11
+ def use_dwrko_via_api(prompt):
12
+ """Use Dwrko-M1.0 via HuggingFace Spaces API"""
13
+
14
+ api_url = "https://dwrkotech-dwrko-m1-0.hf.space/api/predict"
15
+
16
+ payload = {
17
+ "data": [prompt]
18
+ }
19
+
20
+ response = requests.post(api_url, json=payload)
21
+ return response.json()
22
+
23
+ # Method 2: Direct Integration
24
+ def use_dwrko_direct():
25
+ """Direct integration example"""
26
+
27
+ from transformers import AutoTokenizer, AutoModelForCausalLM
28
+
29
+ # Load your trained Dwrko-M1.0
30
+ tokenizer = AutoTokenizer.from_pretrained("dwrkotech/Dwrko-M1.0")
31
+ model = AutoModelForCausalLM.from_pretrained("dwrkotech/Dwrko-M1.0")
32
+
33
+ # Generate response
34
+ prompt = "Write a Python function to calculate factorial"
35
+ inputs = tokenizer(prompt, return_tensors="pt")
36
+ outputs = model.generate(**inputs, max_length=200)
37
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
38
+
39
+ return response
40
+
41
+ # Method 3: Gradio Interface Integration
42
+ def create_custom_interface():
43
+ """Create custom interface using Dwrko-M1.0"""
44
+
45
+ import gradio as gr
46
+
47
+ def dwrko_chat(message):
48
+ # Call your Dwrko-M1.0 API
49
+ response = use_dwrko_via_api(message)
50
+ return response
51
+
52
+ # Create custom interface
53
+ interface = gr.Interface(
54
+ fn=dwrko_chat,
55
+ inputs="text",
56
+ outputs="text",
57
+ title="My Custom Dwrko-M1.0 Assistant",
58
+ description="Powered by Dwrko-M1.0"
59
+ )
60
+
61
+ return interface
62
+
63
+ # Example usage
64
+ if __name__ == "__main__":
65
+ # Test API method
66
+ result = use_dwrko_via_api("Explain what is machine learning")
67
+ print("API Response:", result)
68
+
69
+ # Test direct method (requires model download)
70
+ # result = use_dwrko_direct()
71
+ # print("Direct Response:", result)
72
+
73
+ # Launch custom interface
74
+ # interface = create_custom_interface()
75
+ # interface.launch()