Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +173 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: raft-space
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,173 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>RAFT: AI Question Answering</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 11 |
+
body {
|
| 12 |
+
font-family: 'Inter', sans-serif;
|
| 13 |
+
background-color: #f8fafc;
|
| 14 |
+
}
|
| 15 |
+
.gradient-text {
|
| 16 |
+
background: linear-gradient(90deg, #3b82f6, #8b5cf6);
|
| 17 |
+
-webkit-background-clip: text;
|
| 18 |
+
background-clip: text;
|
| 19 |
+
color: transparent;
|
| 20 |
+
}
|
| 21 |
+
.shadow-soft {
|
| 22 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
|
| 23 |
+
}
|
| 24 |
+
.textarea-gradient:focus {
|
| 25 |
+
border-image: linear-gradient(90deg, #3b82f6, #8b5cf6);
|
| 26 |
+
border-image-slice: 1;
|
| 27 |
+
}
|
| 28 |
+
.button-gradient {
|
| 29 |
+
background: linear-gradient(90deg, #3b82f6, #8b5cf6);
|
| 30 |
+
}
|
| 31 |
+
.answer-box {
|
| 32 |
+
background: linear-gradient(135deg, rgba(167, 243, 208, 0.2), rgba(209, 250, 229, 0.2));
|
| 33 |
+
}
|
| 34 |
+
</style>
|
| 35 |
+
</head>
|
| 36 |
+
<body class="min-h-screen bg-gray-50">
|
| 37 |
+
<div class="container mx-auto px-4 py-12 max-w-6xl">
|
| 38 |
+
<!-- Header -->
|
| 39 |
+
<div class="text-center mb-12">
|
| 40 |
+
<h1 class="text-4xl font-bold mb-2 gradient-text">🤖 RAFT</h1>
|
| 41 |
+
<p class="text-xl text-gray-600">Retrieval-Augmented Fine-Tuning for Question Answering</p>
|
| 42 |
+
<div class="w-24 h-1 bg-gradient-to-r from-blue-500 to-purple-500 mx-auto mt-4 rounded-full"></div>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
<!-- Main Card -->
|
| 46 |
+
<div class="bg-white rounded-xl shadow-soft p-6 mb-8">
|
| 47 |
+
<p class="text-gray-600 mb-6">Ask a question based on the provided context...</p>
|
| 48 |
+
|
| 49 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
| 50 |
+
<!-- Context Input -->
|
| 51 |
+
<div>
|
| 52 |
+
<label for="context" class="block text-sm font-medium text-gray-700 mb-2 flex items-center">
|
| 53 |
+
<i class="fas fa-align-left mr-2 text-blue-500"></i>
|
| 54 |
+
Context
|
| 55 |
+
</label>
|
| 56 |
+
<textarea
|
| 57 |
+
id="context"
|
| 58 |
+
rows="8"
|
| 59 |
+
class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-300 transition text-gray-700 textarea-gradient"
|
| 60 |
+
placeholder="Paste your context here..."></textarea>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<!-- Question Input -->
|
| 64 |
+
<div>
|
| 65 |
+
<label for="question" class="block text-sm font-medium text-gray-700 mb-2 flex items-center">
|
| 66 |
+
<i class="fas fa-question-circle mr-2 text-purple-500"></i>
|
| 67 |
+
Question
|
| 68 |
+
</label>
|
| 69 |
+
<textarea
|
| 70 |
+
id="question"
|
| 71 |
+
rows="3"
|
| 72 |
+
class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-200 focus:border-purple-300 transition text-gray-700 textarea-gradient"
|
| 73 |
+
placeholder="Enter your question here..."></textarea>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<!-- Generate Button -->
|
| 78 |
+
<div class="flex justify-center mb-8">
|
| 79 |
+
<button
|
| 80 |
+
id="generateBtn"
|
| 81 |
+
class="button-gradient text-white px-8 py-3 rounded-lg font-medium transform hover:scale-105 transition active:scale-95 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-300">
|
| 82 |
+
<i class="fas fa-bolt mr-2"></i> Generate Answer
|
| 83 |
+
</button>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<!-- Answer Output -->
|
| 87 |
+
<div class="answer-box p–6 rounded-xl">
|
| 88 |
+
<label for="answer" class="block text-sm font-medium text-gray-700 mb-2 flex items-center">
|
| 89 |
+
<i class="fas fa-lightbulb mr-2 text-green-500"></i>
|
| 90 |
+
Answer
|
| 91 |
+
</label>
|
| 92 |
+
<div
|
| 93 |
+
id="answer"
|
| 94 |
+
class="w-full px-4 py-4 rounded-lg border border-green-200 bg-green-50 min-h-[100px] text-gray-700">
|
| 95 |
+
Your answer will appear here...
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
|
| 100 |
+
<!-- Footer Note -->
|
| 101 |
+
<div class="text-center text-gray-500 text-sm mt-12">
|
| 102 |
+
<p>Powered by deepset/roberta-base-squad2 AI model</p>
|
| 103 |
+
<p class="mt-1">RAFT: Retrieval-Augmented Fine-Tuning Technology</p>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<!-- Loading Spinner (hidden by default) -->
|
| 108 |
+
<div id="loading" class="fixed inset-0 bg-black bg-opacity-30 flex items-center justify-center z-50 hidden">
|
| 109 |
+
<div class="bg-white p-6 rounded-xl shadow-xl flex flex-col items-center">
|
| 110 |
+
<div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500 mb-4"></div>
|
| 111 |
+
<p class="text-gray-700">Analyzing context and question...</p>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<script>
|
| 116 |
+
// For demo purposes - mock API call
|
| 117 |
+
document.getElementById('generateBtn').addEventListener('click', function() {
|
| 118 |
+
const context = document.getElementById('context').value;
|
| 119 |
+
const question = document.getElementById('question').value;
|
| 120 |
+
|
| 121 |
+
if (!context || !question) {
|
| 122 |
+
alert('Please provide both context and question');
|
| 123 |
+
return;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
// Show loading spinner
|
| 127 |
+
document.getElementById('loading').classList.remove('hidden');
|
| 128 |
+
|
| 129 |
+
// Simulate API call delay
|
| 130 |
+
setTimeout(() => {
|
| 131 |
+
// Hide loading spinner
|
| 132 |
+
document.getElementById('loading').classList.add('hidden');
|
| 133 |
+
|
| 134 |
+
// Demo answer generation
|
| 135 |
+
const possibleAnswers = [
|
| 136 |
+
"This is the AI-generated answer based on the provided context.",
|
| 137 |
+
"The answer appears to be within the specified range mentioned in the text.",
|
| 138 |
+
"Based on the context, the most likely answer is shown here.",
|
| 139 |
+
"No definitive answer could be extracted from this context.",
|
| 140 |
+
"The response suggests multiple possible interpretations.",
|
| 141 |
+
"The question doesn't directly relate to the provided context."
|
| 142 |
+
];
|
| 143 |
+
|
| 144 |
+
const randomAnswer = possibleAnswers[Math.floor(Math.random() * possibleAnswers.length)];
|
| 145 |
+
document.getElementById('answer').textContent = randomAnswer;
|
| 146 |
+
|
| 147 |
+
// Pulse animation for answer
|
| 148 |
+
const answerBox = document.getElementById('answer');
|
| 149 |
+
answerBox.classList.remove('pulse');
|
| 150 |
+
void answerBox.offsetWidth; // Trigger reflow
|
| 151 |
+
answerBox.classList.add('pulse');
|
| 152 |
+
|
| 153 |
+
}, 1500);
|
| 154 |
+
});
|
| 155 |
+
|
| 156 |
+
// Add animation to answer box when it appears
|
| 157 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 158 |
+
const style = document.createElement('style');
|
| 159 |
+
style.textContent = `
|
| 160 |
+
@keyframes pulse {
|
| 161 |
+
0% { transform: scale(1); }
|
| 162 |
+
50% { transform: scale(1.02); }
|
| 163 |
+
100% { transform: scale(1); }
|
| 164 |
+
}
|
| 165 |
+
.pulse {
|
| 166 |
+
animation: pulse 0.5s ease;
|
| 167 |
+
}
|
| 168 |
+
`;
|
| 169 |
+
document.head.appendChild(style);
|
| 170 |
+
});
|
| 171 |
+
</script>
|
| 172 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=S-Dreamer/raft-space" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 173 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|